package com.ibeeking.found.auth.api.feign;

import com.ibeeking.found.auth.api.common.dto.MemberLoginDTO;
import com.ibeeking.found.auth.api.common.param.LoginMemberParam;
import com.ibeeking.found.auth.api.common.param.MemberLogoutParam;
import com.ibeeking.found.auth.api.common.query.LoginAuthQuery;
import com.ibeeking.found.auth.api.common.query.OpenIdQuery;
import com.ibeeking.found.auth.api.feign.fallback.MemberLoginFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-member-c-server", contextId = "memberLoginClient", path = "/c", fallbackFactory = MemberLoginFallbackFactory.class, decode404 = true)
public interface MemberLoginClient {

    /**
     * 会员查询
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/member/feign/v1/queryLoginMember")
    ResponseResult<MemberLoginDTO> queryLoginMember(@RequestBody LoginMemberParam param);

    /**
     * 会员退出登录
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/member/feign/v1/logout")
    ResponseResult<Boolean> logout(@RequestBody MemberLogoutParam param);

    /**
     * 通过OpenId查询登录会员
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/member/feign/v1/queryLoginMemberByOpenId")
    ResponseResult<MemberLoginDTO> queryLoginMemberByOpenId(@RequestBody OpenIdQuery query);

    /**
     * 通过手机号查询
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/member/feign/v1/queryLoginMemberByMobileOpenId")
    ResponseResult<MemberLoginDTO> queryLoginMemberByMobileOpenId(@RequestBody LoginAuthQuery query);
}
